using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Krile.Kernel.Plugin;

namespace Krile.Kernel.Data
{
    abstract public class Service
    {
        /// <summary>
        /// Service Name
        /// </summary>
        abstract public string Name { get; }

        /// <summary>
        /// Service Id
        /// </summary>
        abstract public string Id { get; }

        /// <summary>
        /// Service Uri
        /// </summary>
        abstract public Uri ServiceUri { get; }

        /// <summary>
        /// Service Icon
        /// <para>(supposed 16x16 (equals favicon))</para>
        /// </summary>
        abstract public Image ServiceIcon { get; }

        /// <summary>
        /// Service Color
        /// <para>You may use darker color.</para>
        /// </summary>
        abstract public Color ServiceColor { get; }

        /// <summary>
        /// Service Fore Color(General:white)
        /// </summary>
        abstract public Color ForeColor { get; }

        /// <summary>
        /// Service Secondary Color
        /// <para>You should use lighter color.</para>
        /// </summary>
        abstract public Color SecondaryColor { get; }

        /// <summary>
        /// Parent Plugin's Identification String
        /// </summary>
        abstract public string ParentPluginId { get; }

        /// <summary>
        /// Lookup Parent Plugin
        /// </summary>
        public IPlugin ParentPlugin
        {
            get
            {
                IPlugin ret = null;
                if ((ret = Bridge.PluginManager.Lookup(ParentPluginId)) == null)
                    throw new NullReferenceException("Plugin Lookup Failed:" + ParentPluginId + " was not found.");
                return ret;
            }
        }

        public Plugin.Operations.IAgent ParentAgent
        {
            get
            {
                return (Plugin.Operations.IAgent)ParentPlugin.Operation;
            }
        }

        public sealed override string ToString()
        {
            return Name;
        }
    }
}
